package com.xy.model;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

/*
 * @班级表
 */
@SuppressWarnings("serial")
@Entity
@Table
@Cacheable
public class BJi extends Identified implements Serializable {
	
	@Column(nullable = false)
	private String name;// 班级名称
	@Column(nullable = false)
	private String grade;// 年级
	private String remark;// 备注
	//对应类别
	@ManyToOne(targetEntity = Category.class)
	@JoinColumn(name = "Category_id", referencedColumnName = "id")
	@Cascade(CascadeType.SAVE_UPDATE)
	private Category category;
	//对应专业
	@ManyToOne(targetEntity = Major.class)
	@JoinColumn(name = "Major_id", referencedColumnName = "id")
	@Cascade(CascadeType.SAVE_UPDATE)
	private Major major;
	//对应层次
	@ManyToOne(targetEntity =Level.class)
	@JoinColumn(name = "Level_id", referencedColumnName = "id")
	@Cascade(CascadeType.SAVE_UPDATE)
	private Level level;
	//对应书费管理
	@OneToMany(targetEntity=BookFee.class ,mappedBy="bJi")
	private Set<BookFee> bookFees=new HashSet<BookFee>();
	//对应学生表
	@OneToMany(targetEntity=Student.class ,mappedBy="bJi")//学生表
	
	private Set<Student> students=new HashSet<Student>();
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getGrade() {
		return grade;
	}
	public void setGrade(String grade) {
		this.grade = grade;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
  public Category getCategory() {
    return category;
  }
  public void setCategory(Category category) {
    this.category = category;
  }
  public Major getMajor() {
    return major;
  }
  public void setMajor(Major major) {
    this.major = major;
  }
  public Level getLevel() {
    return level;
  }
  public void setLevel(Level level) {
    this.level = level;
  }
  public Set<BookFee> getBookFees() {
    return bookFees;
  }
  public void setBookFees(Set<BookFee> bookFees) {
    this.bookFees = bookFees;
  }
  public Set<Student> getStudents() {
    return students;
  }
  public void setStudents(Set<Student> students) {
    this.students = students;
  }
  public BJi() {
    super();
    // TODO Auto-generated constructor stub
  }

}
